<template>
  <div id="singleBank">
    <div class="banktitle">选择行社\机构</div>
    <div class="bankBox" v-for="(item,index) in cities" :key="index">
      <div class="boxline">
        <span class="boxcity">{{item.cName}}</span>
      </div>
      <div class="yinhang">
        <span v-for="(ele, k) in item.list" :key="k" :class="[ele.checked? 'active':'','spanbank']" @click="spanClick(index, k)">{{ele.bName}}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['cities'],
  name: 'singleBank',
  data () {
    return {
    };
  },
  methods: {
    spanClick (index, k) {
      this.$message({message: '已选择'+this.cities[index].list[k].bName,type: 'success'});
      this.$emit('sendbank',this.cities[index].list[k]);
    },
  },
};
</script>

<style lang="scss">
  #singleBank {
    position: absolute;
    left: 0px;
    right: 0px;
    top: 0;
    bottom: 0px;
    z-index: 2000;
    padding-bottom: 20px;
    overflow-y: auto;
    background-color: rgb(225, 226, 220);
    .banktitle {
      height: 50px;
      line-height: 50px;
      font-size: 16px;
      padding-left: 20px;
      background-color:#809092;
      border-bottom: 1px solid #ccc;
      color: white;
    }
    .bankBox {
      .boxline{
        padding: 0 20px;
        display: flex;
        justify-content: space-between;
        height: 40px;
        align-items: center;
        background-color: #F0F0F0;
      }
    }
    .yinhang {
      background-color: white;
      padding: 20px;
      padding-top: 10px;  
      .spanbank {
        display: inline-block;
        padding: 5px 10px;
        border: 1px solid black;
        margin-right: 20px;
        margin-top: 10px;
        cursor: pointer;
        &.active {
          background-color: #3399CC;
          color: white;
        }
      }
    }
    .btnCh {
      margin-top: 20px;
      display: flex;
      justify-content: center;
      .el-button {
        margin-right: 20px;
      }
    }
  }
</style>
